﻿<!DCOTYPE  html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>站内外流量来源————细粒度</title>
         <link rel="stylesheet" href="/css/theme/font-awesome.min.css" type="text/css" />
        <link rel="stylesheet" href="/css/theme/bootstrap.min.css" type="text/css" />
        <link rel="stylesheet" href="/javascript/theme/libs/jquery-easyui-1.4/themes/default/easyui.css" type="text/css" />
        <link rel="stylesheet" href="/css/theme/App.css" type="text/css" />
        <link rel="stylesheet" href="/css/theme/custom.css" type="text/css" />
        <script src="/javascript/theme/libs/jquery-1.9.1.min.js"></script>
        <script src="/javascript/theme/libs/jquery-easyui-1.4/jquery.easyui.min.js"></script>
        <script src="/javascript/theme/libs/bootstrap.min.js"></script>
        <script src="/javascript/theme/App.js"></script>
        <script type="text/javascript" src="/javascript/My97DatePicker/WdatePicker.js"></script>
        <script type="text/javascript" src="/javascript/report/FusionCharts.js"></script>
        <script type="text/javascript" src="../javascript/report/Date.js"></script>
        <style type="text/css">
            .alink {
            text-decoration:underline;
            color:#0000CC;
            }
            .alinkClicked {
            color:#0000CC;
            }
            #cates,#locals,#cateClean,#localClean{
            display:none;
            }
        </style>
    </head>
    <body>
        <div id="content" style="OVERFLOW-X:yes;OVERFLOW-Y:auto;">
            <div id="content-container">
                <form action="/Statistics/ClickEventsSource" class="form-horizontal" name="searchform" role="form" method="post"  onsubmit="return check();">
                    <div class="portlet">
                        <div class="portlet-header">
                            <h3>
                                <i class="fa fa-tasks"></i>
                                站内外流量来源 <span style="color:#FF6624">2015-09-07之前的导流数据查询，请访问：</span><a href="http://bi.t.58.com/big/ClickEventsSource">旧版入口</a>
                            </h3>
                        </div>
                        <!-- /.portlet-header -->
<div class="portlet-content">
  </br>
   <div class="form-group">
    <label class="col-md-2">日 期 :</label>
    <div class="col-md-2">
        <input  type="text" id="startDate" name="startDate" style="width:150px" class="Wdate form-control" value="$!{startDate}" onclick="WdatePicker({skin:'ext',dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-#{%d}'})"/>
    </div>
    <label class="col-md-2">---</label>
    <div class="col-md-2">
        <input  type="text" id="endDate" name="endDate" style="width:150px" class="Wdate form-control" value="$!{endDate}" onclick="WdatePicker({skin:'ext',dateFmt:'yyyy-MM-dd',maxDate:'%y-%M-#{%d}'})"/>
    </div>
    <div class="col-md-2">
        <input type="radio" name="selectdate" onclick="selectDate('-7')"/>
        近7天
        <input type="radio" name="selectdate" onclick="selectDate('-1m')"/>
        近1月
    </div>
</div>
<div class="form-group">
<label class="col-md-2">平  台 : </label>
<div class="col-md-2">
        <input type="radio" name="platform" value="58PC" #if($!{platform}=='58PC') checked #end  />58PC&nbsp;&nbsp;&nbsp;
        <input type="radio" name="platform" value="58M" #if($!{platform}=='58M') checked #end /> 58M &nbsp;&nbsp;&nbsp;
        <input type="radio" name="platform" value="chinahrPC" #if($!{platform}=='chinahrPC') checked #end  />中华英才网PC&nbsp;&nbsp;&nbsp;
        <input type="radio" name="platform" value="chinahrM" #if($!{platform}=='chinahrM') checked #end /> 中华英才网M &nbsp;&nbsp;&nbsp;
</div>
</div>
<div class="form-group">
    <label class="col-md-2">维度选择: </label>
    <div class="col-md-2">
       <input type="checkbox" name="PageTypeCombine" id="PageTypeCombine" value="pagetype" onclick="selectcheck(this, 'TwoPageTypeCombine')" #if($!{PageTypeCombine}=='pagetype') checked #end  />
            页面类型&nbsp;&nbsp;&nbsp;
       <input type="checkbox" name="TwoPageTypeCombine" id="TwoPageTypeCombine" value="TwoPageType" #if($!{TwoPageTypeCombine}=='TwoPageType') checked #elseif($!{PageTypeCombine}!='pagetype') disabled='true' #end  />
            二级页面类型&nbsp;&nbsp;&nbsp;
       <input type="checkbox" name="cateOneCombine" id="cateOneCombine" value="cate1" onclick="selectcheck(this, 'cateTwoCombine')" #if($!{cateOneCombine}=='cate1') checked #end  />
            一级类别&nbsp;&nbsp;&nbsp;
       <input type="checkbox" name="cateTwoCombine" id="cateTwoCombine" value="cate2" #if($!{cateTwoCombine}=='cate2') checked #elseif($!{cateOneCombine}!='cate1') disabled='true' #end  />
            二级类别&nbsp;&nbsp;&nbsp;
    </div>
</div>
<div class="form-group">
    <label class="col-md-2">指标选择: </label>
    <div class="col-md-2">
       <input type="checkbox" name="PvIndex" id="PvIndex" value="pv" #if($!{PvIndex}=='pv') checked #end  />
            PV&nbsp;&nbsp;&nbsp;
       <input type="checkbox" name="UvIndex" id="UvIndex" value="uv" #if($!{UvIndex}=='uv') checked #end  />
            UV&nbsp;&nbsp;&nbsp;
    </div>
</div>
<div class="form-group">
    <label class="col-md-2" id="modelselect"  >来源名称: </label>
     <div class="col-md-2" id="sourcequery">
    <input type="text" class="form-control" style="width:300px" name="sourcename" id="sourcename" value="$!{sourcename}" />
    </div>&nbsp;
   <!--  <div class="col-md-2" hidden="hidden" id="detailquery">
        <label class="col-md-2">&nbsp;&nbsp;业务类别:</label>
            <div class="col-md-2">
                <input type="hidden" id="initalbusiness" value="$!filebusiness" />
                <select  id="filebusiness" name="filebusiness" value="$!{filebusiness}" style="width:130px;height:25px">
                    #foreach( $business in $businessList)
                    <option value="$!{business}"  #if($business == $!{filebusiness}) selected #end>$!{business}</option>
                    #end
                </select>
            </div>
         <label class="col-md-2">&nbsp;&nbsp;城市:</label>
            <div class="col-md-2">
                <input type="hidden" id="initalcity" value="$!filecity" />
                <select  id="filecity" name="filecity" value="$!{filecity}" style="width:130px;height:25px">
                    #foreach( $city in $cityList)
                    <option value="$!{city}"  #if($city == $!{filecity}) selected #end>$!{city}</option>
                    #end
                </select>
            </div>
          <label class="col-md-2">&nbsp;&nbsp;页面类型:</label>
            <div class="col-md-2">
                <input type="text" class="form-control" style="width:50px" name="pagetype" id="pagetype" value="$!{pagetype}" />
            </div>
           <label class="col-md-2">&nbsp;&nbsp;页面名称:</label>
            <div class="col-md-2">
                <input type="text" class="form-control" style="width:50px" name="pagename" id="pagename" value="$!{pagename}" />
            </div>
    </div> -->
    <textarea style="width:100px;height:20px"  hidden="hidden"  name="typename" id="typename" value="$!{typename}" >$!{selecttype}</textarea>
    <input type="submit" class="btn btn-primary btn-xs" value="查询"  />&nbsp;&nbsp;&nbsp;
    <button type="button" id="download" name="download" onclick="downword()" class="btn btn-primary btn-xs">
                            导出EXCEL
    </button>
</div>
</div>
</div><!--portlet-content-->
</div><!--portlet-->
</form>
 #if($rsList)
<div class="portlet">
    <div class="portlet-header">
        <h3>
            <i class="fa fa-hand-o-up"></i>
            查询结果
        </h3>
    </div>
        <div class="portlet-content">
            <div class="table-responsive">
                <table class="table table-striped table-bordered table-hover" id="wordtable" data-provide="datatable" data-display-rows="20" >
                    <thead>
                        <tr>
                                <th  style="text-align:center;">日期</th>
                                <th  style="text-align:center;">来源名</th>
                                #if($!{PageTypeCombine}=='pagetype')
                                <th  style="text-align:center;">页面类型</th>
                                #end
                                #if($!{TwoPageTypeCombine}=='TwoPageType')
                                <th  style="text-align:center;">二级页面</th>
                                #end
                                #if($!{cateOneCombine}=='cate1')
                                <th  style="text-align:center;">一级类别</th>
                                #end
                                #if($!{cateTwoCombine}=='cate2')
                                <th  style="text-align:center;">二级类别</th>
                                #end
                                #if($!{PvIndex}=='pv')
                                <th  style="text-align:center;">浏览量PV</th>
                                #end
                                #if($!{UvIndex}=='uv')
                                <th  style="text-align:center;">访客数UV</th>
                                #end
                        </tr>
                    </thead>
                    <tbody>
                        #foreach($rs in $rsList)
                            <tr  align="center" >  
                                <td>$!rs.statdate</td>
                                <td>$!rs.sourcename</td>
                                #if($!{PageTypeCombine}=='pagetype')
                                <td>$!rs.pagetype</td>
                                #end
                                #if($!{TwoPageTypeCombine}=='TwoPageType')
                                <td>$!rs.twopagetype</td>
                                #end
                                #if($!{cateOneCombine}=='cate1')
                                <td>$!rs.cate1</td>
                                #end
                                #if($!{cateTwoCombine}=='cate2')
                                <td>$!rs.cate2</td>
                                #end
                                #if($!{PvIndex}=='pv')
                                <td>$!rs.pv</td>
                                #end
                                #if($!{UvIndex}=='uv')
                                <td>$!rs.uv</td>
                                #end
                            </tr>
                        #end												
                    </tbody>
                </table>
                 <div class="row dt-rb">
                            #parse("/views/default/newpage.vm")
                            #pagenew($pList "/Statistics/ClickEventsSource?#page#&$paramurl")
                </div>
            </div>
        </div>
</div>
 #end
</div>
</div>
<script >
    function changemodel(){
                     if(document.getElementById('sourcequery').hidden==false)
                       {
                           document.getElementById('selecttype').value="sourcequery";
                           document.getElementById('detailquery').hidden=false;
                           document.getElementById('sourcequery').hidden=true;
                           document.getElementById('modelselect').innerText="详细查询(点击切换来源名称)";
                       }
                     else
                       {
                           document.getElementById('selecttype').value="detailquery";
                           document.getElementById('detailquery').hidden=true;
                           document.getElementById('sourcequery').hidden=false;
                           document.getElementById('modelselect').innerText="来源名称(点击切换详细查询)";
                       }
        
        }
    $(function(){
               $("#filecity").combobox({
                    selectOnNavigation: true,
                    onSelect: function(newVal,oldVal){
                        var city = $("#filecity").combobox('getValue');
                        
                    }
               });
               $("#filecity").combobox('setValue',$('#initalcity').val());
         });
     $(function(){
               $("#filebusiness").combobox({
                    selectOnNavigation: true,
                    onSelect: function(newVal,oldVal){
                        var city = $("#filebusiness").combobox('getValue');
                        
                    }
               });
               $("#filebusiness").combobox('setValue',$('#initalbusiness').val());
         });
    function downword(){
        check();
        document.getElementById('typename').value="excel";
        searchform.submit();
        document.getElementById('typename').value="";
    }
    function textclear(){
        document.getElementById('URLname').value="";
    }
    function formatDate(oldDate) { 
        var dates = oldDate.split("-");
        var newDate = dates[0];
        
        for(var i = 1;i < dates.length; i++){
            var temp = dates[i];
            if(temp < 10){  
                newDate = newDate+"-0"+temp
            }else{
                newDate = newDate+"-"+temp
            }
        }
    
        return newDate;
    }  
    function selectDate(dayNum){
        var endDate = new Date();
        var startDate = "";
        if(dayNum == "-7"){
        var uom = new Date(new Date()-0+(-7)*86400000);
        startDate = uom.getFullYear() + "-" +  (uom.getMonth()+1) + "-" + uom.getDate();
        }else if(dayNum == "-1m"){
        if(endDate.getMonth() == 0){
        startDate = endDate.getFullYear()-1 + "-12-" + endDate.getDate();
        }else{
        startDate = endDate.getFullYear() + "-" + endDate.getMonth() + "-" + endDate.getDate();
        }
        }
        endDate = endDate.getFullYear() + "-" +  (endDate.getMonth()+1) + "-" + endDate.getDate();
        startDate = formatDate (startDate);
        endDate = formatDate (endDate);
        $("#endDate").val(endDate);
        $("#startDate").val(startDate);
    }
    function selectcheck(levelone, leveltwo) {
      if($(levelone).is(':checked')){
       document.getElementById(leveltwo).disabled=false;
      }else{
        document.getElementById(leveltwo).disabled=true;
        document.getElementById(leveltwo).checked=false;
      }
    }
    function check(){
        var startDate = $("#startDate").val();
        if(startDate == ""){
        alert("请选择起始时间!");
        return false;
        }
        var endDate = $("#endDate").val();
        if(endDate == ""){
        alert("请选择截止时间!");
        return false;
        }
        if(startDate>endDate){
        alert("截止时间不能大于起始时间!");
        return false;
        }
        if($("#URLname").val()=="")
         alert("请填写页面URL!");
        if($("#TwoPageTypeCombine").is(':checked')){
         document.getElementById('PageTypeCombine').disabled=false;
        }
        if($("#cateTwoCombine").is(':checked')){
         document.getElementById('cateOneCombine').disabled=false;
        }
    }
</script>
</body>
</html>
